<template>
  <div>
      <button @click="btn">点击改变颜色</button>
      <p :style="{color:color}">你好</p>
  </div>
</template>

<script>
export default {
    data () {
        return {
            r : '',
            g : '',
            b : '',
            color : '',
        }
    },
    methods:{
        btn(){//十六进制颜色随机
			this.r = Math.floor(Math.random()*256);
			this.g = Math.floor(Math.random()*256);
			this.b = Math.floor(Math.random()*256);
			this.color = '#'+this.r.toString(16)+this.g.toString(16)+this.b.toString(16);
			return this.color;
		}
    }
}
</script>

<style>

</style>